<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
    <script src="https://unpkg.com/vue-router@4"></script> 
</head>
<body>
    <div id="app">
        <router-link to="name:'home">主页</router-link>
        <router-view name="Menu"></router-view>
        <router-view></router-view>
        <router-view name="Footer"></router-view>
    </div>
</body>
<script>
    //局部组件
    const Home={
        template:`<h2>主页信息</h2>`
    }
    const Menu={
        template:`<h2>菜单信息</h2>`
    }
    const Footer={
        template:`<h2>页脚信息</h2>`
    }
    //路由配置
    const routes=[
        {
            path:'/',
            name:'home',
            components:{
                default:Home,
                Menu,
                Footer
            }
        }
    ]
    const router=VueRouter.createRouter({
        history:VueRouter.createWebHashHistory(),
        routes:routes
    
    }
    )
    const app=Vue.createApp({})
    app.use(router)
    app.mount('#app')
</script>
</html>